<template>
    <van-nav-bar title="商品列表" left-text="返回" left-arrow @click-left="($router.push('/'))" fixed />
    <div style="height: 50px;"></div>
    <div v-for="item in goodsDate">
        <router-link :to="'/detail/'+item.goods_id">
            <van-card num="2" :price="item.goods_price" desc="描述信息" :title="item.goods_name"
                thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg">
                <template #thumb>
                    <img style="width: 100%;" :src="item.goods_big_logo" alt="">
                </template>
            </van-card>
        </router-link>

    </div>

</template>

<script setup>
import { ref } from 'vue'
import { goodsApi } from '@/api/api'
let goodsDate = ref([])
import { useRoute, useRouter } from 'vue-router'
let route = new useRoute()
let router = new useRouter()
console.log(route.params.cat_name)
const goods = () => {
    goodsApi(route.params.cat_name).then(res => {
        console.log('商品列表', res)
        goodsDate.value = res.data.message.goods
    })
}
goods()
</script>

<style lang="scss" scoped></style>